<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\libs\Constants;
/* @var $this yii\web\View */
/* @var $model backend\models\Mission */

$this->title                   = $model->title;
$this->params['breadcrumbs'][] = ['label' => '任务', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="mission-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <?= DetailView::widget([
        'model'      => $model,
        'attributes' => [
            'id',
            [
                'label' => "用户名",
                'value' => function ($model) {
                    return $model->u->username;
                }
            ],
            [
                'attribute' => 'forbidden',
                'value'     => function ($model) {
                    return Constants::getForbiddenStatus($model->forbidden);
                }
            ],
            'title',
            'content:ntext',
            'contact_name',
            'contact_phone',
            [
                'label' => '地址',
                'value' => function ($model) {
                    \common\helpers\Util::getLocationByAdCode((int)$model->ad_code);
                }
            ],
            [
                'attribute' => 'pay_type',
                'value'     => function ($model) {
                    return Constants::getPayTypeMission($model->pay_type);
                }
            ],
            [
                'attribute' => 'start_at'
            ],
            [
                'attribute' => 'end_at'
            ],
            [
                'attribute' => 'work_start'
            ],
            [
                'attribute' => 'work_end'
            ],
            'created_at:datetime',
            'updated_at:datetime',
        ],
    ]) ?>

</div>
